package lambdademo;

import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.Consumer;

public class TestMap {
	public static void main(String[] args) {
		Map<String,Integer> map=new HashMap<>();
		map.put("hello",1);
		map.put("abc",1);
		map.put("word",1);
		map.forEach(new BiConsumer<String, Integer>() {
			@Override
			public void accept(String s, Integer integer) {
				System.out.println("key"+s+" "+"vlaue"+integer);
			}
		});
		map.forEach((str,integer)-> System.out.println("key"+str+" "+"integer"+integer));
		List<String > list=new ArrayList<>();
		list.add("hello");
		list.add("word");
		list.add("welcome");
		list.forEach(new Consumer<String>() {
			@Override
			public void accept(String s) {
				System.out.println(s);
			}
		});
		list.forEach((s)-> System.out.println(s));
		list.sort(new Comparator<String>() {
			@Override
			public int compare(String o1, String o2) {
				return o1.compareTo(o2);
			}
		});
		list.sort((o1,o2)->o1.compareTo(o2));
	}
}
